﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QAxObject>
#include <QFileDialog>
#include <QSettings>
#include <QFile>
#include <QDir>
#include <QFileInfo>
#include <QClipboard>
#include "baiduocronline.h"
#include "screenwidget.h"
#include "parameters.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void setIniFile(const QString& api_key, const QString& secret_key);

private slots:
    void getStdOCRResult(QString content);
    void getPreciseOCRResult(QString content);
    void getidCardScanResult(QString content);
    void getbankCardScanResult(QString content);
    void getvehicleCardScanResult(QString content);
    void getdriveCardScanResult(QString content);
    void getlicensePlateScanResult(QString content);
    void getvat_invoiceScanResult(QString content);
    void getquota_invoiceScanResult(QString content);
    void getfamily_bookScanResult(QMap<QString, QString> content);

    void drawPixmap(const QPixmap& pixmap);

    void on_open_img_triggered();

    void on_act_baidu_triggered();

    void on_shot_screen_triggered();

    void on_actHelp_triggered();

    void on_actSetPara_triggered();

    void on_actAbout_triggered();

    void on_openDir_clicked();

    void on_postRequest_clicked();
    void familyRecognition();
    void getRecognitionError(QString err);
    void on_writeToExcel_clicked();

    void on_actCopy_triggered();

private:
    Ui::MainWindow *ui;
    QTimer* timer;
    QSettings* iniFile;
    QClipboard *clipboard;

    BaiduOCROnline* BaiduOCR;
    ScreenWidget* swidget;
    Parameters* ParaDialog;

    QStringList familyList; //所选目录的所有文件名
    QStringList familyList1;
    QList<QMap<QString, QString>> allResults;
};
#endif // MAINWINDOW_H
